package com.zlm.weather;

import com.zlm.weather.quartz.ApiWeatherDataSyscJob;
import org.minbox.framework.api.boot.plugin.quartz.ApiBootQuartzService;
import org.minbox.framework.api.boot.plugin.quartz.wrapper.support.ApiBootCronJobWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class WeatherApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(WeatherApplication.class, args);
    }

    @Autowired
    private ApiBootQuartzService apiBootQuartzService;

    @Override
    public void run(String... args) throws Exception {
        //apiBootQuartzService.newJob(ApiBootOnceJobWrapper.Context().jobClass(ApiWeatherDataSyscJob.class).wrapper());
        apiBootQuartzService.newJob(ApiBootCronJobWrapper.Context().jobClass(ApiWeatherDataSyscJob.class).cron("0 0 0/3 * * ?").wrapper());
    }

}
